import requests
from lxml import etree
import requests_cache as rc
rc.install_cache()
res = rc.CachedSession()
url = 'https://www.dy2018.com/index.html'

header = {
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.57",
}
text1 = requests.get(url,headers=header)#text = requests.get(url, headers=header)
text1.encoding='gb2312'#text.encoding = "gb2312"
text1 = etree.HTML(text1.text1)#html = etree.HTML(text.text)
result = text1.xpath('//div[@class="co_content222"]')[7]#result = html.xpath('//div[@class="co_content222"]')[7]

print(result)
for i in result:
    linkinfo = i.xpath('./li/a/@href')  #
    titleinfo = i.xpath('./li/a/@title')
    #
    print("链接", linkinfo, "标题", titleinfo)